package drds.binlog.sink;

import drds.binlog.common.Authors;
import drds.binlog.common.LifeCycle;
import drds.binlog.sink.group.GroupEntrySink;
import drds.common.Author;

import java.net.InetSocketAddress;

/**
 * event事件消费者
 * 1. 剥离filter/sink为独立的两个动作，方便在快速判断数据是否有效
 */
@Author(name = Authors.LI_YANG)
public interface IEntrySink<EntryList> extends LifeCycle
{
    /**
     * 中断消费，比如解析模块发生了切换，想临时中断当前的merge请求，清理对应的上下文状态，可见{@linkplain GroupEntrySink}
     */
    void interrupt();

    /**
     * 提交数据
     */
    boolean sink(EntryList entryList, InetSocketAddress remoteAddress, String destination) throws SinkException,
            InterruptedException;


}
